<template>
  <div>
    订单页面
    <div class="address">
      <div class="addresslist">
        <div>{{ address.name }}</div>
        <div class="info">
          <p>{{ address.mobile }}</p>
          <p>{{ address.address }}{{ address.address_detail }}</p>
        </div>
        <div></div>
      </div>
    </div>
    <div class="order">
      <ul class="orderbox">
        <li>
          <div>商品合计</div>
          <div>¥{{ allPrise }}</div>
        </li>
        <li>
          <div>运费</div>
          <div>免运费</div>
        </li>
        <li>
          <div>优惠券</div>
          <div>暂无</div>
        </li>
      </ul>

      <van-swipe-cell v-for="item in goodsList" :key="item.id">
        <van-card
          :num="item.number"
          :price="item.retail_price"
          :title="item.goods_name"
          class="goods-card"
          :thumb="item.list_pic_url"
        />
      </van-swipe-cell>
    </div>

    <div class="bottom">
      <div>实付:¥{{ allPrise }}</div>
      <div @click="zhifu">支付</div>
    </div>
  </div>
</template>

<script>
import { submitAction, detailAction } from "@/api/cart/order/index";
import Vue from "vue";

import { Toast } from "vant";

Vue.use(Toast);
export default {
  data() {
    return {
      list: [],
      address: {},
      goodsList: [],
    };
  },
  computed: {},
  created() {
    this.init();
  },
  mounted() {},
  methods: {
    init() {
      detailAction({
        openId: localStorage.getItem("openId"),
        addressId: "",
      }).then((res) => {
        console.log(res);
        this.address = res.data.address;
        this.allPrise = res.data.allPrise;
        this.goodsList = res.data.goodsList;
      });
    },
    zhifu() {
      Toast({
        message: "支付功能暂未开发",
        position: "middle",
      });
    },
  },
};
</script>

<style scoped lang="scss">
.address {
  background: url(http://yanxuan.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-bg-bd30f2bfeb.png)
    0 0 repeat-x #fff;
  padding: 0.66667rem 0 0.4rem 0;
  margin-bottom: 0.26667rem;
  height: 104px;
  width: 100%;
  .addresslist {
    width: 100%;
    position: relative;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    div:first-child {
      width: 1.33333rem;
      text-align: center;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      align-self: flex-start;
      margin-top: 10px;
    }

    .info {
      padding: 0 0.26667rem;
      flex: 1;
      width: 240px;
      height: 64px;
      text-align: left;
    }
    div:nth-child(3) {
      width: 0.66667rem;
      height: 0.66667rem;
      margin: 0 0.26667rem;
      background: url(http://yanxuan-static.nosdn.127.net/hxm/yanxuan-wap/p/20161201/style/img/icon-normal/address-right-596d39df1e.png)
        no-repeat;
      background-size: 100% 100%;
    }
  }
}
.orderbox {
  padding: 0 0.4rem;
  background: #fff;
  height: 150px;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 16px;
  li {
    box-sizing: border-box;
    width: 344px;
    height: 50px;
    padding: 0.4rem 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #d9d9d9;
  }
}

.bottom {
  position: fixed;
  bottom: 0;
  height: 1.33333rem;
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
  display: flex;
  background: #fff;
  justify-content: space-between;
  div:first-child {
    flex: 1;
    line-height: 1.33333rem;
    text-align: left;
    font-size: 14px;
  }
  div:nth-child(2) {
    width: 2.66667rem;
    height: 1.33333rem;
    text-align: center;
    line-height: 1.33333rem;
    font-size: 0.38667rem;
    background: #b4282d;
    color: #fff;
  }
}
</style>